package com.wuster.mapper;

import com.wuster.entity.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wuster.entity.OrderListVO;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
* @author Admin
* @description 针对表【order】的数据库操作Mapper
* @createDate 2024-07-04 21:14:46
* @Entity com.wuster.entity.Order
*/

@Repository
public interface OrderMapper extends BaseMapper<Order> {

    //查询已完成的订单数
    @Select("select count(*) from `t_order` where state=3")
    public int selectOrderFinish();

    //查询待发货的订单数
    @Select("select count(*) from `t_order` where state=1")
    public int selectOrderNotSend();

    //多表查询
    //查看订单详情
    //根据id查出对应的订单信息
    @Select("select * from `t_order` where id = #{orderId}")
    public Order getOrderData(int orderId);

    //获取订单列表分页查询(包含按条件查询订单)
    public List<OrderListVO> getOrderListBy(Map<String,Object> map);

}




